package edu.nf.ch09.controller;

import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author wangl
 * @date 2025/9/19
 */
@Controller
public class LoginController {

    @PostMapping("/login")
    public String login(@RequestParam("user") String user,
                        HttpSession session) {
        session.setAttribute("user", user);
        //重定向到聊天页面
        return "redirect:/chat.html";
    }
}